home *** CD-ROM | disk | FTP | other *** search
Unknown | 1980-01-01 | 7.4 KB |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was not able to be converted.
This format is not currently supported by dexvert.
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
100%
| file
| MacBinary II, inited, Sat Jan 26 21:37:18 1985, modified Mon Dec 31 23:54:05 1979, 6808 bytes "xldmem.c" , at 0x1b18 490 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
100%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| dearkID
| deark: macbinary
| default
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 78 6c 64 6d 65 6d | 2e 63 00 00 00 00 00 00 |..xldmem|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 01 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 1a 98 00 | 00 01 ea 98 7f 66 de 8e |........|.....f..|
|00000060| f4 9b 6d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..m.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 83 25 00 00 |........|.....%..|
|00000080| 2f 2a 20 78 6c 64 6d 65 | 6d 20 2d 20 78 6c 69 73 |/* xldme|m - xlis|
|00000090| 70 20 64 79 6e 61 6d 69 | 63 20 6d 65 6d 6f 72 79 |p dynami|c memory|
|000000a0| 20 6d 61 6e 61 67 65 6d | 65 6e 74 20 72 6f 75 74 | managem|ent rout|
|000000b0| 69 6e 65 73 20 2a 2f 0d | 0d 23 69 6e 63 6c 75 64 |ines */.|.#includ|
|000000c0| 65 20 22 78 6c 69 73 70 | 2e 68 22 0d 0d 2f 2a 20 |e "xlisp|.h"../* |
|000000d0| 75 73 65 66 75 6c 20 64 | 65 66 69 6e 69 74 69 6f |useful d|efinitio|
|000000e0| 6e 73 20 2a 2f 0d 23 64 | 65 66 69 6e 65 20 41 4c |ns */.#d|efine AL|
|000000f0| 4c 4f 43 53 49 5a 45 20 | 28 73 69 7a 65 6f 66 28 |LOCSIZE |(sizeof(|
|00000100| 73 74 72 75 63 74 20 73 | 65 67 6d 65 6e 74 29 20 |struct s|egment) |
|00000110| 2b 20 28 61 6e 6f 64 65 | 73 2d 31 29 20 2a 20 73 |+ (anode|s-1) * s|
|00000120| 69 7a 65 6f 66 28 4e 4f | 44 45 29 29 0d 0d 2f 2a |izeof(NO|DE))../*|
|00000130| 20 65 78 74 65 72 6e 61 | 6c 20 76 61 72 69 61 62 | externa|l variab|
|00000140| 6c 65 73 20 2a 2f 0d 65 | 78 74 65 72 6e 20 4e 4f |les */.e|xtern NO|
|00000150| 44 45 20 2a 6f 62 6c 69 | 73 74 2c 2a 6b 65 79 6c |DE *obli|st,*keyl|
|00000160| 69 73 74 3b 0d 65 78 74 | 65 72 6e 20 4e 4f 44 45 |ist;.ext|ern NODE|
|00000170| 20 2a 78 6c 73 74 61 63 | 6b 3b 0d 65 78 74 65 72 | *xlstac|k;.exter|
|00000180| 6e 20 4e 4f 44 45 20 2a | 78 6c 65 6e 76 2c 2a 78 |n NODE *|xlenv,*x|
|00000190| 6c 6e 65 77 65 6e 76 3b | 0d 65 78 74 65 72 6e 20 |lnewenv;|.extern |
|000001a0| 6c 6f 6e 67 20 74 6f 74 | 61 6c 3b 0d 65 78 74 65 |long tot|al;.exte|
|000001b0| 72 6e 20 69 6e 74 20 61 | 6e 6f 64 65 73 2c 6e 6e |rn int a|nodes,nn|
|000001c0| 6f 64 65 73 2c 6e 73 65 | 67 73 2c 6e 66 72 65 65 |odes,nse|gs,nfree|
|000001d0| 2c 67 63 63 61 6c 6c 73 | 3b 0d 65 78 74 65 72 6e |,gccalls|;.extern|
|000001e0| 20 73 74 72 75 63 74 20 | 73 65 67 6d 65 6e 74 20 | struct |segment |
|000001f0| 2a 73 65 67 73 3b 0d 65 | 78 74 65 72 6e 20 4e 4f |*segs;.e|xtern NO|
|00000200| 44 45 20 2a 73 5f 73 74 | 64 6f 75 74 3b 0d 65 78 |DE *s_st|dout;.ex|
|00000210| 74 65 72 6e 20 4e 4f 44 | 45 20 2a 66 6e 6f 64 65 |tern NOD|E *fnode|
|00000220| 73 3b 0d 65 78 74 65 72 | 6e 20 63 68 61 72 20 62 |s;.exter|n char b|
|00000230| 75 66 5b 5d 3b 0d 0d 2f | 2a 20 65 78 74 65 72 6e |uf[];../|* extern|
|00000240| 61 6c 20 70 72 6f 63 65 | 64 75 72 65 73 20 2a 2f |al proce|dures */|
|00000250| 0d 65 78 74 65 72 6e 20 | 63 68 61 72 20 2a 6d 61 |.extern |char *ma|
|00000260| 6c 6c 6f 63 28 29 3b 0d | 65 78 74 65 72 6e 20 63 |lloc();.|extern c|
|00000270| 68 61 72 20 2a 63 61 6c | 6c 6f 63 28 29 3b 0d 0d |har *cal|loc();..|
|00000280| 2f 2a 20 6e 65 77 6e 6f | 64 65 20 2d 20 61 6c 6c |/* newno|de - all|
|00000290| 6f 63 61 74 65 20 61 20 | 6e 65 77 20 6e 6f 64 65 |ocate a |new node|
|000002a0| 20 2a 2f 0d 4e 4f 44 45 | 20 2a 6e 65 77 6e 6f 64 | */.NODE| *newnod|
|000002b0| 65 28 74 79 70 65 29 0d | 20 20 69 6e 74 20 74 79 |e(type).| int ty|
|000002c0| 70 65 3b 0d 7b 0d 20 20 | 20 20 4e 4f 44 45 20 2a |pe;.{. | NODE *|
|000002d0| 6e 6e 6f 64 65 3b 0d 0d | 20 20 20 20 2f 2a 20 67 |nnode;..| /* g|
|000002e0| 65 74 20 61 20 66 72 65 | 65 20 6e 6f 64 65 20 2a |et a fre|e node *|
|000002f0| 2f 0d 20 20 20 20 69 66 | 20 28 28 6e 6e 6f 64 65 |/. if| ((nnode|
|00000300| 20 3d 20 66 6e 6f 64 65 | 73 29 20 3d 3d 20 4e 49 | = fnode|s) == NI|
|00000310| 4c 29 20 7b 0d 09 67 63 | 28 29 3b 0d 09 69 66 20 |L) {..gc|();..if |
|00000320| 28 28 6e 6e 6f 64 65 20 | 3d 20 66 6e 6f 64 65 73 |((nnode |= fnodes|
|00000330| 29 20 3d 3d 20 4e 49 4c | 29 0d 09 20 20 20 20 78 |) == NIL|).. x|
|00000340| 6c 61 62 6f 72 74 28 22 | 69 6e 73 75 66 66 69 63 |labort("|insuffic|
|00000350| 69 65 6e 74 20 6e 6f 64 | 65 20 73 70 61 63 65 22 |ient nod|e space"|
|00000360| 29 3b 0d 20 20 20 20 7d | 0d 0d 20 20 20 20 2f 2a |);. }|.. /*|
|00000370| 20 75 6e 6c 69 6e 6b 20 | 74 68 65 20 6e 6f 64 65 | unlink |the node|
|00000380| 20 66 72 6f 6d 20 74 68 | 65 20 66 72 65 65 20 6c | from th|e free l|
|00000390| 69 73 74 20 2a 2f 0d 20 | 20 20 20 66 6e 6f 64 65 |ist */. | fnode|
|000003a0| 73 20 3d 20 63 64 72 28 | 6e 6e 6f 64 65 29 3b 0d |s = cdr(|nnode);.|
|000003b0| 20 20 20 20 6e 66 72 65 | 65 20 2d 3d 20 31 3b 0d | nfre|e -= 1;.|
|000003c0| 0d 20 20 20 20 2f 2a 20 | 69 6e 69 74 69 61 6c 69 |. /* |initiali|
|000003d0| 7a 65 20 74 68 65 20 6e | 65 77 20 6e 6f 64 65 20 |ze the n|ew node |
|000003e0| 2a 2f 0d 20 20 20 20 6e | 6e 6f 64 65 2d 3e 6e 5f |*/. n|node->n_|
|000003f0| 74 79 70 65 20 3d 20 74 | 79 70 65 3b 0d 20 20 20 |type = t|ype;. |
|00000400| 20 72 70 6c 61 63 64 28 | 6e 6e 6f 64 65 2c 4e 49 | rplacd(|nnode,NI|
|00000410| 4c 29 3b 0d 0d 20 20 20 | 20 2f 2a 20 72 65 74 75 |L);.. | /* retu|
|00000420| 72 6e 20 74 68 65 20 6e | 65 77 20 6e 6f 64 65 20 |rn the n|ew node |
|00000430| 2a 2f 0d 20 20 20 20 72 | 65 74 75 72 6e 20 28 6e |*/. r|eturn (n|
|00000440| 6e 6f 64 65 29 3b 0d 7d | 0d 0d 2f 2a 20 73 74 72 |node);.}|../* str|
|00000450| 61 6c 6c 6f 63 20 2d 20 | 61 6c 6c 6f 63 61 74 65 |alloc - |allocate|
|00000460| 20 6d 65 6d 6f 72 79 20 | 66 6f 72 20 61 20 73 74 | memory |for a st|
|00000470| 72 69 6e 67 20 61 64 64 | 69 6e 67 20 61 20 62 79 |ring add|ing a by|
|00000480| 74 65 20 66 6f 72 20 74 | 68 65 20 74 65 72 6d 69 |te for t|he termi|
|00000490| 6e 61 74 6f 72 20 2a 2f | 0d 63 68 61 72 20 2a 73 |nator */|.char *s|
|000004a0| 74 72 61 6c 6c 6f 63 28 | 73 69 7a 65 29 0d 20 20 |tralloc(|size). |
|000004b0| 69 6e 74 20 73 69 7a 65 | 3b 0d 7b 0d 20 20 20 20 |int size|;.{. |
|000004c0| 63 68 61 72 20 2a 73 70 | 74 72 3b 0d 0d 20 20 20 |char *sp|tr;.. |
|000004d0| 20 2f 2a 20 61 6c 6c 6f | 63 61 74 65 20 6d 65 6d | /* allo|cate mem|
|000004e0| 6f 72 79 20 66 6f 72 20 | 74 68 65 20 73 74 72 69 |ory for |the stri|
|000004f0| 6e 67 20 63 6f 70 79 20 | 2a 2f 0d 20 20 20 20 69 |ng copy |*/. i|
|00000500| 66 20 28 28 73 70 74 72 | 20 3d 20 6d 61 6c 6c 6f |f ((sptr| = mallo|
|00000510| 63 28 73 69 7a 65 2b 31 | 29 29 20 3d 3d 20 4e 55 |c(size+1|)) == NU|
|00000520| 4c 4c 29 20 7b 0d 09 67 | 63 28 29 3b 0d 09 69 66 |LL) {..g|c();..if|
|00000530| 20 28 28 73 70 74 72 20 | 3d 20 6d 61 6c 6c 6f 63 | ((sptr |= malloc|
|00000540| 28 73 69 7a 65 2b 31 29 | 29 20 3d 3d 20 4e 55 4c |(size+1)|) == NUL|
|00000550| 4c 29 0d 09 20 20 20 20 | 78 6c 66 61 69 6c 28 22 |L).. |xlfail("|
|00000560| 69 6e 73 75 66 66 69 63 | 69 65 6e 74 20 73 74 72 |insuffic|ient str|
|00000570| 69 6e 67 20 73 70 61 63 | 65 22 29 3b 0d 20 20 20 |ing spac|e");. |
|00000580| 20 7d 0d 20 20 20 20 74 | 6f 74 61 6c 20 2b 3d 20 | }. t|otal += |
|00000590| 28 6c 6f 6e 67 29 20 28 | 73 69 7a 65 2b 31 29 3b |(long) (|size+1);|
|000005a0| 0d 0d 20 20 20 20 2f 2a | 20 72 65 74 75 72 6e 20 |.. /*| return |
|000005b0| 74 68 65 20 6e 65 77 20 | 73 74 72 69 6e 67 20 6d |the new |string m|
|000005c0| 65 6d 6f 72 79 20 2a 2f | 0d 20 20 20 20 72 65 74 |emory */|. ret|
|000005d0| 75 72 6e 20 28 73 70 74 | 72 29 3b 0d 7d 0d 0d 2f |urn (spt|r);.}../|
|000005e0| 2a 20 73 74 72 73 61 76 | 65 20 2d 20 67 65 6e 65 |* strsav|e - gene|
|000005f0| 72 61 74 65 20 61 20 64 | 79 6e 61 6d 69 63 20 63 |rate a d|ynamic c|
|00000600| 6f 70 79 20 6f 66 20 61 | 20 73 74 72 69 6e 67 20 |opy of a| string |
|00000610| 2a 2f 0d 63 68 61 72 20 | 2a 73 74 72 73 61 76 65 |*/.char |*strsave|
|00000620| 28 73 74 72 29 0d 20 20 | 63 68 61 72 20 2a 73 74 |(str). |char *st|
|00000630| 72 3b 0d 7b 0d 20 20 20 | 20 63 68 61 72 20 2a 73 |r;.{. | char *s|
|00000640| 70 74 72 3b 0d 0d 20 20 | 20 20 2f 2a 20 63 72 65 |ptr;.. | /* cre|
|00000650| 61 74 65 20 61 20 6e 65 | 77 20 73 74 72 69 6e 67 |ate a ne|w string|
|00000660| 20 2a 2f 0d 20 20 20 20 | 73 70 74 72 20 3d 20 73 | */. |sptr = s|
|00000670| 74 72 61 6c 6c 6f 63 28 | 73 74 72 6c 65 6e 28 73 |tralloc(|strlen(s|
|00000680| 74 72 29 29 3b 0d 20 20 | 20 20 73 74 72 63 70 79 |tr));. | strcpy|
|00000690| 28 73 70 74 72 2c 73 74 | 72 29 3b 0d 0d 20 20 20 |(sptr,st|r);.. |
|000006a0| 20 2f 2a 20 72 65 74 75 | 72 6e 20 74 68 65 20 6e | /* retu|rn the n|
|000006b0| 65 77 20 73 74 72 69 6e | 67 20 2a 2f 0d 20 20 20 |ew strin|g */. |
|000006c0| 20 72 65 74 75 72 6e 20 | 28 73 70 74 72 29 3b 0d | return |(sptr);.|
|000006d0| 7d 0d 0d 2f 2a 20 73 74 | 72 66 72 65 65 20 2d 20 |}../* st|rfree - |
|000006e0| 66 72 65 65 20 73 74 72 | 69 6e 67 20 6d 65 6d 6f |free str|ing memo|
|000006f0| 72 79 20 2a 2f 0d 73 74 | 72 66 72 65 65 28 73 74 |ry */.st|rfree(st|
|00000700| 72 29 0d 20 20 63 68 61 | 72 20 2a 73 74 72 3b 0d |r). cha|r *str;.|
|00000710| 7b 0d 20 20 20 20 74 6f | 74 61 6c 20 2d 3d 20 28 |{. to|tal -= (|
|00000720| 6c 6f 6e 67 29 20 28 73 | 74 72 6c 65 6e 28 73 74 |long) (s|trlen(st|
|00000730| 72 29 2b 31 29 3b 0d 20 | 20 20 20 66 72 65 65 28 |r)+1);. | free(|
|00000740| 73 74 72 29 3b 0d 7d 0d | 0d 2f 2a 20 67 63 20 2d |str);.}.|./* gc -|
|00000750| 20 67 61 72 62 61 67 65 | 20 63 6f 6c 6c 65 63 74 | garbage| collect|
|00000760| 20 2a 2f 0d 67 63 28 29 | 0d 7b 0d 20 20 20 20 4e | */.gc()|.{. N|
|00000770| 4f 44 45 20 2a 70 3b 0d | 0d 20 20 20 20 2f 2a 20 |ODE *p;.|. /* |
|00000780| 6d 61 72 6b 20 61 6c 6c | 20 61 63 63 65 73 73 69 |mark all| accessi|
|00000790| 62 6c 65 20 6e 6f 64 65 | 73 20 2a 2f 0d 20 20 20 |ble node|s */. |
|000007a0| 20 6d 61 72 6b 28 6f 62 | 6c 69 73 74 29 3b 20 6d | mark(ob|list); m|
|000007b0| 61 72 6b 28 6b 65 79 6c | 69 73 74 29 3b 0d 20 20 |ark(keyl|ist);. |
|000007c0| 20 20 6d 61 72 6b 28 78 | 6c 65 6e 76 29 3b 0d 20 | mark(x|lenv);. |
|000007d0| 20 20 20 6d 61 72 6b 28 | 78 6c 6e 65 77 65 6e 76 | mark(|xlnewenv|
|000007e0| 29 3b 0d 0d 20 20 20 20 | 2f 2a 20 6d 61 72 6b 20 |);.. |/* mark |
|000007f0| 74 68 65 20 65 76 61 6c | 75 61 74 69 6f 6e 20 73 |the eval|uation s|
|00000800| 74 61 63 6b 20 2a 2f 0d | 20 20 20 20 66 6f 72 20 |tack */.| for |
|00000810| 28 70 20 3d 20 78 6c 73 | 74 61 63 6b 3b 20 70 3b |(p = xls|tack; p;|
|00000820| 20 70 20 3d 20 63 64 72 | 28 70 29 29 0d 09 6d 61 | p = cdr|(p))..ma|
|00000830| 72 6b 28 63 61 72 28 70 | 29 29 3b 0d 0d 20 20 20 |rk(car(p|));.. |
|00000840| 20 2f 2a 20 73 77 65 65 | 70 20 6d 65 6d 6f 72 79 | /* swee|p memory|
|00000850| 20 63 6f 6c 6c 65 63 74 | 69 6e 67 20 61 6c 6c 20 | collect|ing all |
|00000860| 75 6e 6d 61 72 6b 65 64 | 20 6e 6f 64 65 73 20 2a |unmarked| nodes *|
|00000870| 2f 0d 20 20 20 20 73 77 | 65 65 70 28 29 3b 0d 0d |/. sw|eep();..|
|00000880| 20 20 20 20 2f 2a 20 69 | 66 20 74 68 65 72 65 27 | /* i|f there'|
|00000890| 73 20 73 74 69 6c 6c 20 | 6e 6f 74 68 69 6e 67 20 |s still |nothing |
|000008a0| 61 76 61 69 6c 61 62 6c | 65 2c 20 61 6c 6c 6f 63 |availabl|e, alloc|
|000008b0| 61 74 65 20 6d 6f 72 65 | 20 6d 65 6d 6f 72 79 20 |ate more| memory |
|000008c0| 2a 2f 0d 20 20 20 20 69 | 66 20 28 66 6e 6f 64 65 |*/. i|f (fnode|
|000008d0| 73 20 3d 3d 20 4e 49 4c | 29 0d 09 61 64 64 73 65 |s == NIL|)..addse|
|000008e0| 67 28 29 3b 0d 0d 20 20 | 20 20 2f 2a 20 63 6f 75 |g();.. | /* cou|
|000008f0| 6e 74 20 74 68 65 20 67 | 63 20 63 61 6c 6c 20 2a |nt the g|c call *|
|00000900| 2f 0d 20 20 20 20 67 63 | 63 61 6c 6c 73 2b 2b 3b |/. gc|calls++;|
|00000910| 0d 7d 0d 0d 2f 2a 20 6d | 61 72 6b 20 2d 20 6d 61 |.}../* m|ark - ma|
|00000920| 72 6b 20 61 6c 6c 20 61 | 63 63 65 73 73 69 62 6c |rk all a|ccessibl|
|00000930| 65 20 6e 6f 64 65 73 20 | 2a 2f 0d 4c 4f 43 41 4c |e nodes |*/.LOCAL|
|00000940| 20 6d 61 72 6b 28 70 74 | 72 29 0d 20 20 4e 4f 44 | mark(pt|r). NOD|
|00000950| 45 20 2a 70 74 72 3b 0d | 7b 0d 20 20 20 20 4e 4f |E *ptr;.|{. NO|
|00000960| 44 45 20 2a 74 68 69 73 | 2c 2a 70 72 65 76 2c 2a |DE *this|,*prev,*|
|00000970| 74 6d 70 3b 0d 0d 20 20 | 20 20 2f 2a 20 6a 75 73 |tmp;.. | /* jus|
|00000980| 74 20 72 65 74 75 72 6e | 20 6f 6e 20 6e 69 6c 20 |t return| on nil |
|00000990| 2a 2f 0d 20 20 20 20 69 | 66 20 28 70 74 72 20 3d |*/. i|f (ptr =|
|000009a0| 3d 20 4e 49 4c 29 0d 09 | 72 65 74 75 72 6e 3b 0d |= NIL)..|return;.|
|000009b0| 0d 20 20 20 20 2f 2a 20 | 69 6e 69 74 69 61 6c 69 |. /* |initiali|
|000009c0| 7a 65 20 2a 2f 0d 20 20 | 20 20 70 72 65 76 20 3d |ze */. | prev =|
|000009d0| 20 4e 49 4c 3b 0d 20 20 | 20 20 74 68 69 73 20 3d | NIL;. | this =|
|000009e0| 20 70 74 72 3b 0d 0d 20 | 20 20 20 2f 2a 20 6d 61 | ptr;.. | /* ma|
|000009f0| 72 6b 20 74 68 69 73 20 | 6c 69 73 74 20 2a 2f 0d |rk this |list */.|
|00000a00| 20 20 20 20 77 68 69 6c | 65 20 28 54 52 55 45 29 | whil|e (TRUE)|
|00000a10| 20 7b 0d 0d 09 2f 2a 20 | 64 65 73 63 65 6e 64 20 | {.../* |descend |
|00000a20| 61 73 20 66 61 72 20 61 | 73 20 77 65 20 63 61 6e |as far a|s we can|
|00000a30| 20 2a 2f 0d 09 77 68 69 | 6c 65 20 28 54 52 55 45 | */..whi|le (TRUE|
|00000a40| 29 20 7b 0d 0d 09 20 20 | 20 20 2f 2a 20 63 68 65 |) {... | /* che|
|00000a50| 63 6b 20 66 6f 72 20 74 | 68 69 73 20 6e 6f 64 65 |ck for t|his node|
|00000a60| 20 62 65 69 6e 67 20 6d | 61 72 6b 65 64 20 2a 2f | being m|arked */|
|00000a70| 0d 09 20 20 20 20 69 66 | 20 28 74 68 69 73 2d 3e |.. if| (this->|
|00000a80| 6e 5f 66 6c 61 67 73 20 | 26 20 4d 41 52 4b 29 0d |n_flags |& MARK).|
|00000a90| 09 09 62 72 65 61 6b 3b | 0d 0d 09 20 20 20 20 2f |..break;|... /|
|00000aa0| 2a 20 6d 61 72 6b 20 69 | 74 20 61 6e 64 20 69 74 |* mark i|t and it|
|00000ab0| 73 20 64 65 73 63 65 6e | 64 61 6e 74 73 20 2a 2f |s descen|dants */|
|00000ac0| 0d 09 20 20 20 20 65 6c | 73 65 20 7b 0d 0d 09 09 |.. el|se {....|
|00000ad0| 2f 2a 20 6d 61 72 6b 20 | 74 68 65 20 6e 6f 64 65 |/* mark |the node|
|00000ae0| 20 2a 2f 0d 09 09 74 68 | 69 73 2d 3e 6e 5f 66 6c | */...th|is->n_fl|
|00000af0| 61 67 73 20 7c 3d 20 4d | 41 52 4b 3b 0d 0d 09 09 |ags |= M|ARK;....|
|00000b00| 2f 2a 20 66 6f 6c 6c 6f | 77 20 74 68 65 20 6c 65 |/* follo|w the le|
|00000b10| 66 74 20 73 75 62 6c 69 | 73 74 20 69 66 20 74 68 |ft subli|st if th|
|00000b20| 65 72 65 20 69 73 20 6f | 6e 65 20 2a 2f 0d 09 09 |ere is o|ne */...|
|00000b30| 69 66 20 28 6c 69 76 65 | 63 61 72 28 74 68 69 73 |if (live|car(this|
|00000b40| 29 29 20 7b 0d 09 09 20 | 20 20 20 74 68 69 73 2d |)) {... | this-|
|00000b50| 3e 6e 5f 66 6c 61 67 73 | 20 7c 3d 20 4c 45 46 54 |>n_flags| |= LEFT|
|00000b60| 3b 0d 09 09 20 20 20 20 | 74 6d 70 20 3d 20 70 72 |;... |tmp = pr|
|00000b70| 65 76 3b 0d 09 09 20 20 | 20 20 70 72 65 76 20 3d |ev;... | prev =|
|00000b80| 20 74 68 69 73 3b 0d 09 | 09 20 20 20 20 74 68 69 | this;..|. thi|
|00000b90| 73 20 3d 20 63 61 72 28 | 70 72 65 76 29 3b 0d 09 |s = car(|prev);..|
|00000ba0| 09 20 20 20 20 72 70 6c | 61 63 61 28 70 72 65 76 |. rpl|aca(prev|
|00000bb0| 2c 74 6d 70 29 3b 0d 09 | 09 7d 0d 0d 09 09 2f 2a |,tmp);..|.}..../*|
|00000bc0| 20 6f 74 68 65 72 77 69 | 73 65 2c 20 66 6f 6c 6c | otherwi|se, foll|
|00000bd0| 6f 77 20 74 68 65 20 72 | 69 67 68 74 20 73 75 62 |ow the r|ight sub|
|00000be0| 6c 69 73 74 20 69 66 20 | 74 68 65 72 65 20 69 73 |list if |there is|
|00000bf0| 20 6f 6e 65 20 2a 2f 0d | 09 09 65 6c 73 65 20 69 | one */.|..else i|
|00000c00| 66 20 28 6c 69 76 65 63 | 64 72 28 74 68 69 73 29 |f (livec|dr(this)|
|00000c10| 29 20 7b 0d 09 09 20 20 | 20 20 74 68 69 73 2d 3e |) {... | this->|
|00000c20| 6e 5f 66 6c 61 67 73 20 | 26 3d 20 7e 4c 45 46 54 |n_flags |&= ~LEFT|
|00000c30| 3b 0d 09 09 20 20 20 20 | 74 6d 70 20 3d 20 70 72 |;... |tmp = pr|
|00000c40| 65 76 3b 0d 09 09 20 20 | 20 20 70 72 65 76 20 3d |ev;... | prev =|
|00000c50| 20 74 68 69 73 3b 0d 09 | 09 20 20 20 20 74 68 69 | this;..|. thi|
|00000c60| 73 20 3d 20 63 64 72 28 | 70 72 65 76 29 3b 0d 09 |s = cdr(|prev);..|
|00000c70| 09 20 20 20 20 72 70 6c | 61 63 64 28 70 72 65 76 |. rpl|acd(prev|
|00000c80| 2c 74 6d 70 29 3b 0d 09 | 09 7d 0d 09 09 65 6c 73 |,tmp);..|.}...els|
|00000c90| 65 0d 09 09 20 20 20 20 | 62 72 65 61 6b 3b 0d 09 |e... |break;..|
|00000ca0| 20 20 20 20 7d 0d 09 7d | 0d 0d 09 2f 2a 20 62 61 | }..}|.../* ba|
|00000cb0| 63 6b 75 70 20 74 6f 20 | 61 20 70 6f 69 6e 74 20 |ckup to |a point |
|00000cc0| 77 68 65 72 65 20 77 65 | 20 63 61 6e 20 63 6f 6e |where we| can con|
|00000cd0| 74 69 6e 75 65 20 64 65 | 73 63 65 6e 64 69 6e 67 |tinue de|scending|
|00000ce0| 20 2a 2f 0d 09 77 68 69 | 6c 65 20 28 54 52 55 45 | */..whi|le (TRUE|
|00000cf0| 29 20 7b 0d 0d 09 20 20 | 20 20 2f 2a 20 63 68 65 |) {... | /* che|
|00000d00| 63 6b 20 66 6f 72 20 74 | 65 72 6d 69 6e 61 74 69 |ck for t|erminati|
|00000d10| 6f 6e 20 63 6f 6e 64 69 | 74 69 6f 6e 20 2a 2f 0d |on condi|tion */.|
|00000d20| 09 20 20 20 20 69 66 20 | 28 70 72 65 76 20 3d 3d |. if |(prev ==|
|00000d30| 20 4e 49 4c 29 0d 09 09 | 72 65 74 75 72 6e 3b 0d | NIL)...|return;.|
|00000d40| 0d 09 20 20 20 20 2f 2a | 20 63 68 65 63 6b 20 66 |.. /*| check f|
|00000d50| 6f 72 20 63 6f 6d 69 6e | 67 20 66 72 6f 6d 20 74 |or comin|g from t|
|00000d60| 68 65 20 6c 65 66 74 20 | 73 69 64 65 20 2a 2f 0d |he left |side */.|
|00000d70| 09 20 20 20 20 69 66 20 | 28 70 72 65 76 2d 3e 6e |. if |(prev->n|
|00000d80| 5f 66 6c 61 67 73 20 26 | 20 4c 45 46 54 29 0d 09 |_flags &| LEFT)..|
|00000d90| 09 69 66 20 28 6c 69 76 | 65 63 64 72 28 70 72 65 |.if (liv|ecdr(pre|
|00000da0| 76 29 29 20 7b 0d 09 09 | 20 20 20 20 70 72 65 76 |v)) {...| prev|
|00000db0| 2d 3e 6e 5f 66 6c 61 67 | 73 20 26 3d 20 7e 4c 45 |->n_flag|s &= ~LE|
|00000dc0| 46 54 3b 0d 09 09 20 20 | 20 20 74 6d 70 20 3d 20 |FT;... | tmp = |
|00000dd0| 63 61 72 28 70 72 65 76 | 29 3b 0d 09 09 20 20 20 |car(prev|);... |
|00000de0| 20 72 70 6c 61 63 61 28 | 70 72 65 76 2c 74 68 69 | rplaca(|prev,thi|
|00000df0| 73 29 3b 0d 09 09 20 20 | 20 20 74 68 69 73 20 3d |s);... | this =|
|00000e00| 20 63 64 72 28 70 72 65 | 76 29 3b 0d 09 09 20 20 | cdr(pre|v);... |
|00000e10| 20 20 72 70 6c 61 63 64 | 28 70 72 65 76 2c 74 6d | rplacd|(prev,tm|
|00000e20| 70 29 3b 0d 09 09 20 20 | 20 20 62 72 65 61 6b 3b |p);... | break;|
|00000e30| 0d 09 09 7d 0d 09 09 65 | 6c 73 65 20 7b 0d 09 09 |...}...e|lse {...|
|00000e40| 20 20 20 20 74 6d 70 20 | 3d 20 70 72 65 76 3b 0d | tmp |= prev;.|
|00000e50| 09 09 20 20 20 20 70 72 | 65 76 20 3d 20 63 61 72 |.. pr|ev = car|
|00000e60| 28 74 6d 70 29 3b 0d 09 | 09 20 20 20 20 72 70 6c |(tmp);..|. rpl|
|00000e70| 61 63 61 28 74 6d 70 2c | 74 68 69 73 29 3b 0d 09 |aca(tmp,|this);..|
|00000e80| 09 20 20 20 20 74 68 69 | 73 20 3d 20 74 6d 70 3b |. thi|s = tmp;|
|00000e90| 0d 09 09 7d 0d 0d 09 20 | 20 20 20 2f 2a 20 6f 74 |...}... | /* ot|
|00000ea0| 68 65 72 77 69 73 65 2c | 20 63 61 6d 65 20 66 72 |herwise,| came fr|
|00000eb0| 6f 6d 20 74 68 65 20 72 | 69 67 68 74 20 73 69 64 |om the r|ight sid|
|00000ec0| 65 20 2a 2f 0d 09 20 20 | 20 20 65 6c 73 65 20 7b |e */.. | else {|
|00000ed0| 0d 09 09 74 6d 70 20 3d | 20 70 72 65 76 3b 0d 09 |...tmp =| prev;..|
|00000ee0| 09 70 72 65 76 20 3d 20 | 63 64 72 28 74 6d 70 29 |.prev = |cdr(tmp)|
|00000ef0| 3b 0d 09 09 72 70 6c 61 | 63 64 28 74 6d 70 2c 74 |;...rpla|cd(tmp,t|
|00000f00| 68 69 73 29 3b 0d 09 09 | 74 68 69 73 20 3d 20 74 |his);...|this = t|
|00000f10| 6d 70 3b 0d 09 20 20 20 | 20 7d 0d 09 7d 0d 20 20 |mp;.. | }..}. |
|00000f20| 20 20 7d 0d 7d 0d 0d 2f | 2a 20 73 77 65 65 70 20 | }.}../|* sweep |
|00000f30| 2d 20 73 77 65 65 70 20 | 61 6c 6c 20 75 6e 6d 61 |- sweep |all unma|
|00000f40| 72 6b 65 64 20 6e 6f 64 | 65 73 20 61 6e 64 20 61 |rked nod|es and a|
|00000f50| 64 64 20 74 68 65 6d 20 | 74 6f 20 74 68 65 20 66 |dd them |to the f|
|00000f60| 72 65 65 20 6c 69 73 74 | 20 2a 2f 0d 4c 4f 43 41 |ree list| */.LOCA|
|00000f70| 4c 20 73 77 65 65 70 28 | 29 0d 7b 0d 20 20 20 20 |L sweep(|).{. |
|00000f80| 73 74 72 75 63 74 20 73 | 65 67 6d 65 6e 74 20 2a |struct s|egment *|
|00000f90| 73 65 67 3b 0d 20 20 20 | 20 4e 4f 44 45 20 2a 70 |seg;. | NODE *p|
|00000fa0| 3b 0d 20 20 20 20 69 6e | 74 20 6e 3b 0d 0d 20 20 |;. in|t n;.. |
|00000fb0| 20 20 2f 2a 20 65 6d 70 | 74 79 20 74 68 65 20 66 | /* emp|ty the f|
|00000fc0| 72 65 65 20 6c 69 73 74 | 20 2a 2f 0d 20 20 20 20 |ree list| */. |
|00000fd0| 66 6e 6f 64 65 73 20 3d | 20 4e 49 4c 3b 0d 20 20 |fnodes =| NIL;. |
|00000fe0| 20 20 6e 66 72 65 65 20 | 3d 20 30 3b 0d 0d 20 20 | nfree |= 0;.. |
|00000ff0| 20 20 2f 2a 20 61 64 64 | 20 61 6c 6c 20 75 6e 6d | /* add| all unm|
|00001000| 61 72 6b 65 64 20 6e 6f | 64 65 73 20 2a 2f 0d 20 |arked no|des */. |
|00001010| 20 20 20 66 6f 72 20 28 | 73 65 67 20 3d 20 73 65 | for (|seg = se|
|00001020| 67 73 3b 20 73 65 67 20 | 21 3d 20 4e 55 4c 4c 3b |gs; seg |!= NULL;|
|00001030| 20 73 65 67 20 3d 20 73 | 65 67 2d 3e 73 67 5f 6e | seg = s|eg->sg_n|
|00001040| 65 78 74 29 20 7b 0d 09 | 70 20 3d 20 26 73 65 67 |ext) {..|p = &seg|
|00001050| 2d 3e 73 67 5f 6e 6f 64 | 65 73 5b 30 5d 3b 0d 09 |->sg_nod|es[0];..|
|00001060| 66 6f 72 20 28 6e 20 3d | 20 73 65 67 2d 3e 73 67 |for (n =| seg->sg|
|00001070| 5f 73 69 7a 65 3b 20 6e | 2d 2d 3b 20 70 2b 2b 29 |_size; n|--; p++)|
|00001080| 0d 09 20 20 20 20 69 66 | 20 28 21 28 70 2d 3e 6e |.. if| (!(p->n|
|00001090| 5f 66 6c 61 67 73 20 26 | 20 4d 41 52 4b 29 29 20 |_flags &| MARK)) |
|000010a0| 7b 0d 09 09 73 77 69 74 | 63 68 20 28 6e 74 79 70 |{...swit|ch (ntyp|
|000010b0| 65 28 70 29 29 20 7b 0d | 09 09 63 61 73 65 20 53 |e(p)) {.|..case S|
|000010c0| 54 52 3a 0d 09 09 09 69 | 66 20 28 70 2d 3e 6e 5f |TR:....i|f (p->n_|
|000010d0| 73 74 72 74 79 70 65 20 | 3d 3d 20 44 59 4e 41 4d |strtype |== DYNAM|
|000010e0| 49 43 20 26 26 20 70 2d | 3e 6e 5f 73 74 72 20 21 |IC && p-|>n_str !|
|000010f0| 3d 20 4e 55 4c 4c 29 0d | 09 09 09 20 20 20 20 73 |= NULL).|... s|
|00001100| 74 72 66 72 65 65 28 70 | 2d 3e 6e 5f 73 74 72 29 |trfree(p|->n_str)|
|00001110| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |;....bre|ak;...ca|
|00001120| 73 65 20 46 50 54 52 3a | 0d 09 09 09 69 66 20 28 |se FPTR:|....if (|
|00001130| 70 2d 3e 6e 5f 66 70 29 | 0d 09 09 09 20 20 20 20 |p->n_fp)|.... |
|00001140| 66 63 6c 6f 73 65 28 70 | 2d 3e 6e 5f 66 70 29 3b |fclose(p|->n_fp);|
|00001150| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 7d 0d 09 |....brea|k;...}..|
|00001160| 09 70 2d 3e 6e 5f 74 79 | 70 65 20 3d 20 46 52 45 |.p->n_ty|pe = FRE|
|00001170| 45 3b 0d 09 09 70 2d 3e | 6e 5f 66 6c 61 67 73 20 |E;...p->|n_flags |
|00001180| 3d 20 30 3b 0d 09 09 72 | 70 6c 61 63 61 28 70 2c |= 0;...r|placa(p,|
|00001190| 4e 49 4c 29 3b 0d 09 09 | 72 70 6c 61 63 64 28 70 |NIL);...|rplacd(p|
|000011a0| 2c 66 6e 6f 64 65 73 29 | 3b 0d 09 09 66 6e 6f 64 |,fnodes)|;...fnod|
|000011b0| 65 73 20 3d 20 70 3b 0d | 09 09 6e 66 72 65 65 2b |es = p;.|..nfree+|
|000011c0| 2b 3b 0d 09 20 20 20 20 | 7d 0d 09 20 20 20 20 65 |+;.. |}.. e|
|000011d0| 6c 73 65 0d 09 09 70 2d | 3e 6e 5f 66 6c 61 67 73 |lse...p-|>n_flags|
|000011e0| 20 26 3d 20 7e 28 4d 41 | 52 4b 20 7c 20 4c 45 46 | &= ~(MA|RK | LEF|
|000011f0| 54 29 3b 0d 20 20 20 20 | 7d 0d 7d 0d 0d 2f 2a 20 |T);. |}.}../* |
|00001200| 61 64 64 73 65 67 20 2d | 20 61 64 64 20 61 20 73 |addseg -| add a s|
|00001210| 65 67 6d 65 6e 74 20 74 | 6f 20 74 68 65 20 61 76 |egment t|o the av|
|00001220| 61 69 6c 61 62 6c 65 20 | 6d 65 6d 6f 72 79 20 2a |ailable |memory *|
|00001230| 2f 0d 69 6e 74 20 61 64 | 64 73 65 67 28 29 0d 7b |/.int ad|dseg().{|
|00001240| 0d 20 20 20 20 73 74 72 | 75 63 74 20 73 65 67 6d |. str|uct segm|
|00001250| 65 6e 74 20 2a 6e 65 77 | 73 65 67 3b 0d 20 20 20 |ent *new|seg;. |
|00001260| 20 4e 4f 44 45 20 2a 70 | 3b 0d 20 20 20 20 69 6e | NODE *p|;. in|
|00001270| 74 20 6e 3b 0d 0d 20 20 | 20 20 2f 2a 20 63 68 65 |t n;.. | /* che|
|00001280| 63 6b 20 66 6f 72 20 7a | 65 72 6f 20 61 6c 6c 6f |ck for z|ero allo|
|00001290| 63 61 74 69 6f 6e 20 2a | 2f 0d 20 20 20 20 69 66 |cation *|/. if|
|000012a0| 20 28 61 6e 6f 64 65 73 | 20 3d 3d 20 30 29 0d 09 | (anodes| == 0)..|
|000012b0| 72 65 74 75 72 6e 20 28 | 46 41 4c 53 45 29 3b 0d |return (|FALSE);.|
|000012c0| 0d 20 20 20 20 2f 2a 20 | 61 6c 6c 6f 63 61 74 65 |. /* |allocate|
|000012d0| 20 61 20 6e 65 77 20 73 | 65 67 6d 65 6e 74 20 2a | a new s|egment *|
|000012e0| 2f 0d 20 20 20 20 69 66 | 20 28 28 6e 65 77 73 65 |/. if| ((newse|
|000012f0| 67 20 3d 20 28 73 74 72 | 75 63 74 20 73 65 67 6d |g = (str|uct segm|
|00001300| 65 6e 74 20 2a 29 20 63 | 61 6c 6c 6f 63 28 31 2c |ent *) c|alloc(1,|
|00001310| 41 4c 4c 4f 43 53 49 5a | 45 29 29 20 21 3d 20 4e |ALLOCSIZ|E)) != N|
|00001320| 55 4c 4c 29 20 7b 0d 0d | 09 2f 2a 20 69 6e 69 74 |ULL) {..|./* init|
|00001330| 69 61 6c 69 7a 65 20 74 | 68 65 20 6e 65 77 20 73 |ialize t|he new s|
|00001340| 65 67 6d 65 6e 74 20 2a | 2f 0d 09 6e 65 77 73 65 |egment *|/..newse|
|00001350| 67 2d 3e 73 67 5f 73 69 | 7a 65 20 3d 20 61 6e 6f |g->sg_si|ze = ano|
|00001360| 64 65 73 3b 0d 09 6e 65 | 77 73 65 67 2d 3e 73 67 |des;..ne|wseg->sg|
|00001370| 5f 6e 65 78 74 20 3d 20 | 73 65 67 73 3b 0d 09 73 |_next = |segs;..s|
|00001380| 65 67 73 20 3d 20 6e 65 | 77 73 65 67 3b 0d 0d 09 |egs = ne|wseg;...|
|00001390| 2f 2a 20 61 64 64 20 65 | 61 63 68 20 6e 65 77 20 |/* add e|ach new |
|000013a0| 6e 6f 64 65 20 74 6f 20 | 74 68 65 20 66 72 65 65 |node to |the free|
|000013b0| 20 6c 69 73 74 20 2a 2f | 0d 09 70 20 3d 20 26 6e | list */|..p = &n|
|000013c0| 65 77 73 65 67 2d 3e 73 | 67 5f 6e 6f 64 65 73 5b |ewseg->s|g_nodes[|
|000013d0| 30 5d 3b 0d 09 66 6f 72 | 20 28 6e 20 3d 20 61 6e |0];..for| (n = an|
|000013e0| 6f 64 65 73 3b 20 6e 2d | 2d 3b 20 29 20 7b 0d 09 |odes; n-|-; ) {..|
|000013f0| 20 20 20 20 72 70 6c 61 | 63 64 28 70 2c 66 6e 6f | rpla|cd(p,fno|
|00001400| 64 65 73 29 3b 0d 09 20 | 20 20 20 66 6e 6f 64 65 |des);.. | fnode|
|00001410| 73 20 3d 20 70 2b 2b 3b | 0d 09 7d 0d 0d 09 2f 2a |s = p++;|..}.../*|
|00001420| 20 75 70 64 61 74 65 20 | 74 68 65 20 73 74 61 74 | update |the stat|
|00001430| 69 73 74 69 63 73 20 2a | 2f 0d 09 74 6f 74 61 6c |istics *|/..total|
|00001440| 20 2b 3d 20 28 6c 6f 6e | 67 29 20 41 4c 4c 4f 43 | += (lon|g) ALLOC|
|00001450| 53 49 5a 45 3b 0d 09 6e | 6e 6f 64 65 73 20 2b 3d |SIZE;..n|nodes +=|
|00001460| 20 61 6e 6f 64 65 73 3b | 0d 09 6e 66 72 65 65 20 | anodes;|..nfree |
|00001470| 2b 3d 20 61 6e 6f 64 65 | 73 3b 0d 09 6e 73 65 67 |+= anode|s;..nseg|
|00001480| 73 2b 2b 3b 0d 0d 09 2f | 2a 20 72 65 74 75 72 6e |s++;.../|* return|
|00001490| 20 73 75 63 63 65 73 73 | 66 75 6c 6c 79 20 2a 2f | success|fully */|
|000014a0| 0d 09 72 65 74 75 72 6e | 20 28 54 52 55 45 29 3b |..return| (TRUE);|
|000014b0| 0d 20 20 20 20 7d 0d 20 | 20 20 20 65 6c 73 65 0d |. }. | else.|
|000014c0| 09 72 65 74 75 72 6e 20 | 28 46 41 4c 53 45 29 3b |.return |(FALSE);|
|000014d0| 0d 7d 0d 20 0d 2f 2a 20 | 6c 69 76 65 63 61 72 20 |.}. ./* |livecar |
|000014e0| 2d 20 64 6f 20 77 65 20 | 6e 65 65 64 20 74 6f 20 |- do we |need to |
|000014f0| 66 6f 6c 6c 6f 77 20 74 | 68 65 20 63 61 72 3f 20 |follow t|he car? |
|00001500| 2a 2f 0d 4c 4f 43 41 4c | 20 69 6e 74 20 6c 69 76 |*/.LOCAL| int liv|
|00001510| 65 63 61 72 28 6e 29 0d | 20 20 4e 4f 44 45 20 2a |ecar(n).| NODE *|
|00001520| 6e 3b 0d 7b 0d 20 20 20 | 20 73 77 69 74 63 68 20 |n;.{. | switch |
|00001530| 28 6e 74 79 70 65 28 6e | 29 29 20 7b 0d 20 20 20 |(ntype(n|)) {. |
|00001540| 20 63 61 73 65 20 53 55 | 42 52 3a 0d 20 20 20 20 | case SU|BR:. |
|00001550| 63 61 73 65 20 46 53 55 | 42 52 3a 0d 20 20 20 20 |case FSU|BR:. |
|00001560| 63 61 73 65 20 49 4e 54 | 3a 0d 20 20 20 20 63 61 |case INT|:. ca|
|00001570| 73 65 20 53 54 52 3a 0d | 20 20 20 20 63 61 73 65 |se STR:.| case|
|00001580| 20 46 50 54 52 3a 0d 09 | 20 20 20 20 72 65 74 75 | FPTR:..| retu|
|00001590| 72 6e 20 28 46 41 4c 53 | 45 29 3b 0d 20 20 20 20 |rn (FALS|E);. |
|000015a0| 63 61 73 65 20 53 59 4d | 3a 0d 20 20 20 20 63 61 |case SYM|:. ca|
|000015b0| 73 65 20 4c 49 53 54 3a | 0d 20 20 20 20 63 61 73 |se LIST:|. cas|
|000015c0| 65 20 4f 42 4a 3a 0d 09 | 20 20 20 20 72 65 74 75 |e OBJ:..| retu|
|000015d0| 72 6e 20 28 63 61 72 28 | 6e 29 20 21 3d 20 4e 49 |rn (car(|n) != NI|
|000015e0| 4c 29 3b 0d 20 20 20 20 | 64 65 66 61 75 6c 74 3a |L);. |default:|
|000015f0| 0d 09 20 20 20 20 70 72 | 69 6e 74 66 28 22 62 61 |.. pr|intf("ba|
|00001600| 64 20 6e 6f 64 65 20 74 | 79 70 65 20 28 25 64 29 |d node t|ype (%d)|
|00001610| 20 66 6f 75 6e 64 20 64 | 75 72 69 6e 67 20 6c 65 | found d|uring le|
|00001620| 66 74 20 73 63 61 6e 5c | 6e 22 2c 6e 74 79 70 65 |ft scan\|n",ntype|
|00001630| 28 6e 29 29 3b 0d 09 20 | 20 20 20 65 78 69 74 28 |(n));.. | exit(|
|00001640| 29 3b 0d 20 20 20 20 7d | 0d 7d 0d 0d 2f 2a 20 6c |);. }|.}../* l|
|00001650| 69 76 65 63 64 72 20 2d | 20 64 6f 20 77 65 20 6e |ivecdr -| do we n|
|00001660| 65 65 64 20 74 6f 20 66 | 6f 6c 6c 6f 77 20 74 68 |eed to f|ollow th|
|00001670| 65 20 63 64 72 3f 20 2a | 2f 0d 4c 4f 43 41 4c 20 |e cdr? *|/.LOCAL |
|00001680| 69 6e 74 20 6c 69 76 65 | 63 64 72 28 6e 29 0d 20 |int live|cdr(n). |
|00001690| 20 4e 4f 44 45 20 2a 6e | 3b 0d 7b 0d 20 20 20 20 | NODE *n|;.{. |
|000016a0| 73 77 69 74 63 68 20 28 | 6e 74 79 70 65 28 6e 29 |switch (|ntype(n)|
|000016b0| 29 20 7b 0d 20 20 20 20 | 63 61 73 65 20 53 55 42 |) {. |case SUB|
|000016c0| 52 3a 0d 20 20 20 20 63 | 61 73 65 20 46 53 55 42 |R:. c|ase FSUB|
|000016d0| 52 3a 0d 20 20 20 20 63 | 61 73 65 20 49 4e 54 3a |R:. c|ase INT:|
|000016e0| 0d 20 20 20 20 63 61 73 | 65 20 53 54 52 3a 0d 20 |. cas|e STR:. |
|000016f0| 20 20 20 63 61 73 65 20 | 46 50 54 52 3a 0d 09 20 | case |FPTR:.. |
|00001700| 20 20 20 72 65 74 75 72 | 6e 20 28 46 41 4c 53 45 | retur|n (FALSE|
|00001710| 29 3b 0d 20 20 20 20 63 | 61 73 65 20 53 59 4d 3a |);. c|ase SYM:|
|00001720| 0d 20 20 20 20 63 61 73 | 65 20 4c 49 53 54 3a 0d |. cas|e LIST:.|
|00001730| 20 20 20 20 63 61 73 65 | 20 4f 42 4a 3a 0d 09 20 | case| OBJ:.. |
|00001740| 20 20 20 72 65 74 75 72 | 6e 20 28 63 64 72 28 6e | retur|n (cdr(n|
|00001750| 29 20 21 3d 20 4e 49 4c | 29 3b 0d 20 20 20 20 64 |) != NIL|);. d|
|00001760| 65 66 61 75 6c 74 3a 0d | 09 20 20 20 20 70 72 69 |efault:.|. pri|
|00001770| 6e 74 66 28 22 62 61 64 | 20 6e 6f 64 65 20 74 79 |ntf("bad| node ty|
|00001780| 70 65 20 28 25 64 29 20 | 66 6f 75 6e 64 20 64 75 |pe (%d) |found du|
|00001790| 72 69 6e 67 20 72 69 67 | 68 74 20 73 63 61 6e 5c |ring rig|ht scan\|
|000017a0| 6e 22 2c 6e 74 79 70 65 | 28 6e 29 29 3b 0d 09 20 |n",ntype|(n));.. |
|000017b0| 20 20 20 65 78 69 74 28 | 29 3b 0d 20 20 20 20 7d | exit(|);. }|
|000017c0| 0d 7d 0d 0d 2f 2a 20 73 | 74 61 74 73 20 2d 20 70 |.}../* s|tats - p|
|000017d0| 72 69 6e 74 20 6d 65 6d | 6f 72 79 20 73 74 61 74 |rint mem|ory stat|
|000017e0| 69 73 74 69 63 73 20 2a | 2f 0d 73 74 61 74 73 28 |istics *|/.stats(|
|000017f0| 29 0d 7b 0d 20 20 20 20 | 4e 4f 44 45 20 2a 6f 66 |).{. |NODE *of|
|00001800| 70 74 72 3b 0d 20 20 20 | 20 6f 66 70 74 72 20 3d |ptr;. | ofptr =|
|00001810| 20 73 5f 73 74 64 6f 75 | 74 2d 3e 6e 5f 73 79 6d | s_stdou|t->n_sym|
|00001820| 76 61 6c 75 65 3b 0d 20 | 20 20 20 73 70 72 69 6e |value;. | sprin|
|00001830| 74 66 28 62 75 66 2c 22 | 4e 6f 64 65 73 3a 20 20 |tf(buf,"|Nodes: |
|00001840| 20 20 20 20 20 25 64 5c | 6e 22 2c 6e 6e 6f 64 65 | %d\|n",nnode|
|00001850| 73 29 3b 20 20 78 6c 70 | 75 74 73 74 72 28 6f 66 |s); xlp|utstr(of|
|00001860| 70 74 72 2c 62 75 66 29 | 3b 0d 20 20 20 20 73 70 |ptr,buf)|;. sp|
|00001870| 72 69 6e 74 66 28 62 75 | 66 2c 22 46 72 65 65 20 |rintf(bu|f,"Free |
|00001880| 6e 6f 64 65 73 3a 20 20 | 25 64 5c 6e 22 2c 6e 66 |nodes: |%d\n",nf|
|00001890| 72 65 65 29 3b 20 20 20 | 78 6c 70 75 74 73 74 72 |ree); |xlputstr|
|000018a0| 28 6f 66 70 74 72 2c 62 | 75 66 29 3b 0d 20 20 20 |(ofptr,b|uf);. |
|000018b0| 20 73 70 72 69 6e 74 66 | 28 62 75 66 2c 22 53 65 | sprintf|(buf,"Se|
|000018c0| 67 6d 65 6e 74 73 3a 20 | 20 20 20 25 64 5c 6e 22 |gments: | %d\n"|
|000018d0| 2c 6e 73 65 67 73 29 3b | 20 20 20 78 6c 70 75 74 |,nsegs);| xlput|
|000018e0| 73 74 72 28 6f 66 70 74 | 72 2c 62 75 66 29 3b 0d |str(ofpt|r,buf);.|
|000018f0| 20 20 20 20 73 70 72 69 | 6e 74 66 28 62 75 66 2c | spri|ntf(buf,|
|00001900| 22 41 6c 6c 6f 63 61 74 | 65 3a 20 20 20 20 25 64 |"Allocat|e: %d|
|00001910| 5c 6e 22 2c 61 6e 6f 64 | 65 73 29 3b 20 20 78 6c |\n",anod|es); xl|
|00001920| 70 75 74 73 74 72 28 6f | 66 70 74 72 2c 62 75 66 |putstr(o|fptr,buf|
|00001930| 29 3b 0d 20 20 20 20 73 | 70 72 69 6e 74 66 28 62 |);. s|printf(b|
|00001940| 75 66 2c 22 54 6f 74 61 | 6c 3a 20 20 20 20 20 20 |uf,"Tota|l: |
|00001950| 20 25 6c 64 5c 6e 22 2c | 74 6f 74 61 6c 29 3b 20 | %ld\n",|total); |
|00001960| 20 78 6c 70 75 74 73 74 | 72 28 6f 66 70 74 72 2c | xlputst|r(ofptr,|
|00001970| 62 75 66 29 3b 0d 20 20 | 20 20 73 70 72 69 6e 74 |buf);. | sprint|
|00001980| 66 28 62 75 66 2c 22 43 | 6f 6c 6c 65 63 74 69 6f |f(buf,"C|ollectio|
|00001990| 6e 73 3a 20 25 64 5c 6e | 22 2c 67 63 63 61 6c 6c |ns: %d\n|",gccall|
|000019a0| 73 29 3b 20 78 6c 70 75 | 74 73 74 72 28 6f 66 70 |s); xlpu|tstr(ofp|
|000019b0| 74 72 2c 62 75 66 29 3b | 0d 7d 0d 0d 2f 2a 20 78 |tr,buf);|.}../* x|
|000019c0| 6c 6d 69 6e 69 74 20 2d | 20 69 6e 69 74 69 61 6c |lminit -| initial|
|000019d0| 69 7a 65 20 74 68 65 20 | 64 79 6e 61 6d 69 63 20 |ize the |dynamic |
|000019e0| 6d 65 6d 6f 72 79 20 6d | 6f 64 75 6c 65 20 2a 2f |memory m|odule */|
|000019f0| 0d 78 6c 6d 69 6e 69 74 | 28 29 0d 7b 0d 20 20 20 |.xlminit|().{. |
|00001a00| 20 2f 2a 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 6f | /* init|ialize o|
|00001a10| 75 72 20 69 6e 74 65 72 | 6e 61 6c 20 76 61 72 69 |ur inter|nal vari|
|00001a20| 61 62 6c 65 73 20 2a 2f | 0d 20 20 20 20 61 6e 6f |ables */|. ano|
|00001a30| 64 65 73 20 3d 20 4e 4e | 4f 44 45 53 3b 0d 20 20 |des = NN|ODES;. |
|00001a40| 20 20 74 6f 74 61 6c 20 | 3d 20 30 4c 3b 0d 20 20 | total |= 0L;. |
|00001a50| 20 20 6e 6e 6f 64 65 73 | 20 3d 20 6e 73 65 67 73 | nnodes| = nsegs|
|00001a60| 20 3d 20 6e 66 72 65 65 | 20 3d 20 67 63 63 61 6c | = nfree| = gccal|
|00001a70| 6c 73 20 3d 20 30 3b 0d | 20 20 20 20 66 6e 6f 64 |ls = 0;.| fnod|
|00001a80| 65 73 20 3d 20 4e 49 4c | 3b 0d 20 20 20 20 73 65 |es = NIL|;. se|
|00001a90| 67 73 20 3d 20 4e 55 4c | 4c 3b 0d 0d 20 20 20 20 |gs = NUL|L;.. |
|00001aa0| 2f 2a 20 69 6e 69 74 69 | 61 6c 69 7a 65 20 73 74 |/* initi|alize st|
|00001ab0| 72 75 63 74 75 72 65 73 | 20 74 68 61 74 20 61 72 |ructures| that ar|
|00001ac0| 65 20 6d 61 72 6b 65 64 | 20 62 79 20 74 68 65 20 |e marked| by the |
|00001ad0| 63 6f 6c 6c 65 63 74 6f | 72 20 2a 2f 0d 20 20 20 |collecto|r */. |
|00001ae0| 20 78 6c 73 74 61 63 6b | 20 3d 20 78 6c 65 6e 76 | xlstack| = xlenv|
|00001af0| 20 3d 20 78 6c 6e 65 77 | 65 6e 76 20 3d 20 6f 62 | = xlnew|env = ob|
|00001b00| 6c 69 73 74 20 3d 20 6b | 65 79 6c 69 73 74 20 3d |list = k|eylist =|
|00001b10| 20 4e 49 4c 3b 0d 7d 0d | 00 00 00 00 00 00 00 00 | NIL;.}.|........|
|00001b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b80| 00 00 01 00 00 00 01 16 | 00 00 00 16 00 00 00 d4 |........|........|
|00001b90| 20 5f a0 29 28 50 41 ef | 00 04 22 4d b3 c8 67 00 | _.)(PA.|.."M..g.|
|00001ba0| 00 08 42 58 60 00 ff f6 | 4e ad 09 e2 41 ed 09 e2 |..BX`...|N...A...|
|00001bb0| 08 78 6c 64 6d 65 6d 2e | 63 64 02 00 00 00 00 00 |.xldmem.|cd......|
|00001bc0| 00 00 00 00 00 00 01 00 | 00 c0 00 80 0d 28 00 00 |........|.....(..|
|00001bd0| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 c0 00 80 |........|........|
|00001be0| 0d 28 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.(......|........|
|00001bf0| 00 00 98 7f 66 de 00 00 | 1a 98 00 00 01 ea 4a 40 |....f...|......J@|
|00001c00| 67 0e 48 6c 00 30 4e ba | 63 92 58 8f 4e ba 75 72 |g.Hl.0N.|c.X.N.ur|
|00001c10| 4e ba 55 38 48 6e ff c2 | 4e ba 24 76 58 8f 2f 2d |N.U8Hn..|N.$vX./-|
|00001c20| f5 a6 3f 3c 00 08 48 6e | ff c2 4e ba 24 12 de fc |..?<..Hn|..N.$...|
|00001c30| 00 0a 48 6e ff c8 4e ba | 68 84 58 8f 0c 40 00 00 |..Hn..N.|h.X..@..|
|00001c40| 66 0e 42 67 42 67 48 6c | 00 4c 4e ba 00 a2 50 8f |f.BgBgHl|.LN...P.|
|00001c50| 42 a7 48 6e ff f6 4e ba | 2d ca 50 8f 30 3c 00 01 |B.Hn..N.|-.P.0<..|
|00001c60| 67 50 48 6e ff c8 4e ba | 68 54 58 8f 4a 40 67 10 |gPHn..N.|hTX.J@g.|
|00001c70| 20 6d f5 8e 42 a8 00 06 | 20 6d f5 8a 42 a8 00 06 | m..B...| m..B...|
|00001c80| 00 00 00 0a 00 09 06 4d | 6f 6e 61 63 6f 2c 00 00 |.......M|onaco,..|
|00001c90| 00 04 00 06 00 08 00 00 | 01 00 00 00 01 16 00 00 |........|........|
|00001ca0| 00 16 00 00 00 d4 00 00 | c1 1c 00 98 00 00 00 1c |........|........|
|00001cb0| 00 46 00 01 45 46 4e 54 | 00 00 00 12 45 54 41 42 |.F..EFNT|....ETAB|
|00001cc0| 00 00 00 1e 03 eb 00 00 | 00 00 00 00 00 01 5a f8 |........|......Z.|
|00001cd0| 03 ec 00 47 00 00 00 0e | 00 01 98 d2 46 4f 42 4a |...G....|....FOBJ|
|00001ce0| 00 fe 06 ec 00 40 01 80 | 00 40 01 82 00 40 01 84 |.....@..|.@...@..|
|00001cf0| 00 40 01 86 00 40 01 88 | 00 40 01 8a 00 40 01 8c |.@...@..|.@...@..|
|00001d00| 00 fe 1f 66 00 40 12 a0 | 00 40 01 92 00 40 01 94 |...f.@..|.@...@..|
|00001d10| 00 40 01 94 00 40 01 94 | 00 40 01 94 00 40 01 94 |.@...@..|.@...@..|
|00001d20| 00 40 01 46 4f 42 4a 00 | fe 06 ec 00 40 01 80 00 |.@.FOBJ.|....@...|
|00001d30| 40 01 82 00 40 01 84 00 | 40 01 86 00 40 01 88 00 |@...@...|@...@...|
|00001d40| 40 01 8a 00 40 01 8c 00 | fe 1f 66 00 40 12 a0 00 |@...@...|..f.@...|
|00001d50| 40 01 92 00 40 01 94 00 | 40 01 94 00 40 01 94 00 |@...@...|@...@...|
|00001d60| 40 01 94 00 40 01 94 00 | 40 01 00 00 00 00 00 00 |@...@...|@.......|
|00001d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+